const express = require('express');
const port = 3000;

const app = express();

// token
app.set('secret', '1esdr3sdaf');

app.use(express.json());
app.use(require('cors')());
app.use('/', express.static(__dirname + '/dist'));
app.use('/upload', express.static(__dirname + '/upload'));

// mongosedb
require('./plugins/db')(app);

// admin router
require('./routes/admin/index')(app);
require('./routes/web/index')(app);

app.listen(port, () => {
  console.log(`http://localhost:${port}`);
});
